package com.zoro.interviewee.collection;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhaoxingwu
 */
public class RunTest {
    public static void main(String[] args) {
        List<String> sourceList = new ArrayList<>() ;
        sourceList.add("H");
        sourceList.add("O");
        sourceList.add("L");
        sourceList.add("L");
        sourceList.add("I");
        sourceList.add("S");
        List<String> subList = sourceList.subList(2, 5);
        System.out.println("sourceList ： " + sourceList);
        System.out.println("sourceList.subList(2, 5) 得到List ：");
        System.out.println("subList ： " + subList);
        // 改原list 会出错
//        sourceList.add("666");
        subList.add("777");
        System.out.println("sourceList.add(666) 得到List ：");
        System.out.println("sourceList ： " + sourceList);
        System.out.println("subList ： " + subList);
    }
}
